package com.laisheng.interview.controller;

import com.laisheng.interview.model.AccountingInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;
import java.util.Map;

@RestController
@CrossOrigin(origins = "*")
public class PreviewController {

    // 预览面试信息
    @PostMapping("/api/preview/accounting")
    public ResponseEntity<Map<String, Object>> previewAccountingInfo(@RequestBody AccountingInfo accountingInfo) {
        Map<String, Object> response = new HashMap<>();
        try {
            // 这里可以添加预览逻辑，比如数据验证等
            response.put("success", true);
            response.put("data", accountingInfo);
            response.put("message", "预览成功");
        } catch (Exception e) {
            response.put("success", false);
            response.put("message", "预览失败: " + e.getMessage());
        }
        return ResponseEntity.ok(response);
    }





    // 获取预览数据
    @GetMapping("/api/preview/data/{id}")
    public ResponseEntity<Map<String, Object>> getPreviewData(@PathVariable Long id) {
        Map<String, Object> response = new HashMap<>();
        try {
            // 这里可以从数据库获取数据
            response.put("success", true);
            response.put("message", "获取预览数据成功");
        } catch (Exception e) {
            response.put("success", false);
            response.put("message", "获取预览数据失败: " + e.getMessage());
        }
        return ResponseEntity.ok(response);
    }
} 